package com.testmanager.testmananger.quantitative.mapper;

import com.testmanager.testmananger.quantitative.domain.DevelopInfoEntity;
import com.testmanager.testmananger.quantitative.dto.DevelopInfoDto;
import com.testmanager.testmananger.quantitative.dto.TaskInfoDto;
import com.testmanager.testmananger.quantitative.dto.WorkerDto;

import java.util.List;

public class DevelopInfoMapper {

    public static DevelopInfoDto toDevelopInfoDto(DevelopInfoEntity developInfoEntity, List<WorkerDto> workerDtos, List<TaskInfoDto> taskInfoDtos){
        DevelopInfoDto developInfoDto = new DevelopInfoDto();
        return  developInfoDto.setId(developInfoEntity.getId())
                .setDevelopNo(developInfoEntity.getDevelopNo())
                .setScheduleTimeFrom(developInfoEntity.getScheduleTimeFrom())
                .setScheduleTimeTo(developInfoEntity.getScheduleTimeTo())
                .setPracticeTimeFrom(developInfoEntity.getPracticeTimeFrom())
                .setPracticeTimeTo(developInfoEntity.getPracticeTimeTo())
                .setProgress(developInfoEntity.getProgress())
                .setInterfaceURL(developInfoEntity.getInterfaceURL())
                .setWorkers(workerDtos)
                .setTasks(taskInfoDtos);
    }

    public static DevelopInfoEntity toDevelopInfoEntity(DevelopInfoDto developInfoDto,long iterationId){
        DevelopInfoEntity developInfoEntity = new DevelopInfoEntity();
        return developInfoEntity.setId(developInfoDto.getId())
                .setIterationId(iterationId)
                .setDevelopNo(developInfoDto.getDevelopNo())
                .setScheduleTimeFrom(developInfoDto.getScheduleTimeFrom())
                .setScheduleTimeTo(developInfoDto.getScheduleTimeTo())
                .setPracticeTimeFrom(developInfoDto.getPracticeTimeFrom())
                .setPracticeTimeTo(developInfoDto.getPracticeTimeTo())
                .setProgress(developInfoDto.getProgress())
                .setInterfaceURL(developInfoDto.getInterfaceURL());
    }

}
